/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 29489
 * Date: 2023-03-08
 * Time: 22:34
 */
//public class Main {
//    public static void main(String[] args){
//        Scanner sc = new Scanner(System.in);
//
//        double FrontNum[] = new double[3];
//        double roots[] = new double[2];
//        for(int i = 0; i < 3; i++)
//        {
//            if(!sc.hasNextDouble())
//            {
//                System.out.println("Wrong Format");
//                System.exit(0);
//            }
//            FrontNum[i] = sc.nextDouble();
//            if(FrontNum[0] == 0)
//            {
//                System.out.println("Wrong Format");
//                System.exit(0);
//            }
//        }
//        int root_num = solveQuadratic(FrontNum, roots);
//        if(root_num == 0)
//            System.out.print("The equation has no roots\n");
//        if(root_num == 1)
//            System.out.printf("The equation has one root: %.4f\n", roots[0]);
//        if(root_num == 2)
//            System.out.printf("The equation has two roots: %.4f and %.4f\n", roots[0], roots[1]);
//
//    }
//
//    //eqn存储输入的三个系数a、b、c，
//    //然后将两个实数根存储进roots中，该方法返回实数根的个数。
//    public static int solveQuadratic(double[] eqn, double[] roots)
//    {
//        double deir = eqn[1]*eqn[1] - eqn[0]*eqn[2]*4.0;
//        if(deir > 0)
//        {
//            roots[0] = (-eqn[1]+Math.sqrt(deir))/(2.0*eqn[0]);
//            roots[1] = (-eqn[1]-Math.sqrt(deir))/(2.0*eqn[0]);
//
//            return 2;
//        }
//        if(deir == 0)
//        {
//            roots[0] = roots[1] = (-eqn[1]+Math.sqrt(deir))/(2.0*eqn[0]);
//
//            return 1;
//        }
//
//        return 0;
//    }
//}
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String s[] = str.split(",");
        //System.out.println(str);

        for(int i = 0; i < s.length; i++)
        {
            String inf[] = s[i].split(" ");

            char c1[] = inf[1].toCharArray();
            char c2[] = inf[2].toCharArray();
            int s1 = GetNum(c1[0]);
            int s2 = GetNum(c2[0]);
            System.out.print(inf[0]+" "+(s1+s2));
            if(i < s.length-1)
                System.out.print(",");
        }
    }
    public static int GetNum(char c){
        if(c == 'A')
            return 5;
        if(c == 'B')
            return 4;
        if(c == 'C')
            return 3;
        if(c == 'D')
            return 2;
        if(c == 'E')
            return 1;
        return 0;
    }
}